package org.dromara.patrol.domain.bo;

import jakarta.validation.Valid;
import org.dromara.common.core.enums.patrol.snap.SnapModelType;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import org.dromara.patrol.domain.PatrolSnapPlan;
import org.dromara.patrol.domain.model.snap.DeviceChannel;
import org.dromara.patrol.domain.model.snap.SnapExecuteRule;

import java.util.List;

/**
 * 巡店管理-巡店抓拍配置业务对象 patrol_snap_plan
 *
 * @author LionLi
 * @date 2024-03-27
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = PatrolSnapPlan.class, reverseConvertGenerate = false)
public class PatrolSnapPlanBo extends BaseEntity {

    /**
     * 计划id
     */
    @NotNull(message = "计划id不能为空", groups = { EditGroup.class })
    private Long planId;

    /**
     * 计划名称
     */
    @NotBlank(message = "计划名称不能为空", groups = { AddGroup.class, EditGroup.class })
    private String planName;

    /**
     * 门店id
     */
    @NotNull(message = "门店id不能为空", groups = { AddGroup.class, EditGroup.class })
    private Long storeId;

    /**
     * 设备ids
     */
    @NotEmpty(message = "设备ids不能为空", groups = { AddGroup.class, EditGroup.class })
    private List<Long> deviceIds;

//    /**
//     * 设备通道[
//{
//"deviceId": "24f2303f-8525-11ee-9bed-0329e3f31fb1","channelNo": [
//0,
//1,
//2,
//3
//]},
//{
//"deviceId": "60178e90-e119-11ea-9b05-49adcdf3e65a","channelNo": null}
//]
//     */
//    @NotBlank(message = "设备通道[
//{
//"deviceId": "24f2303f-8525-11ee-9bed-0329e3f31fb1","channelNo": [
//0,
//1,
//2,
//3
//]},
//{
//"deviceId": "60178e90-e119-11ea-9b05-49adcdf3e65a","channelNo": null}
//]不能为空",
    @NotEmpty(message = "设备不能为空", groups = { AddGroup.class, EditGroup.class })
    @Valid
    private List<DeviceChannel> deviceChannel;

    /**
     * 设备预设点
     */
    private String devicePresetPoint;

    /**
     * 拍照时间、循环周期（如：{
                "cycleType": "WEEKLY",
                "weeklyRule": [
                    2,
                    3,
                    4,
                    5,
                    6
                ],
                "customRule": null,
                "snapTime": [
                    {
                        "startTime": "08:30",
                        "endTime": "09:00",
                        "interval": 600
                    }
                ]
            }）
     */
    @NotNull(message = "抓拍时间/循环周期不能为空", groups = { AddGroup.class, EditGroup.class })
    @Valid
    private SnapExecuteRule executeRule;

    /**
     * 抓拍模式（字典表：COMMON 普通抓拍，LOCATION 预置位抓拍）
     * @see org.dromara.common.core.enums.patrol.snap.SnapModelType
     */
    @NotNull(message = "抓拍模式（字典表：COMMON 普通抓拍，LOCATION 预置位抓拍）不能为空", groups = { AddGroup.class, EditGroup.class })
    private SnapModelType snapModel;

}
